// 一星https://iai.sh.cn/problem/477
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  for (int a = 0; a * a <= n; a++) {
    for (int b = a; b <= sqrt(n); b++) {
      for (int c = b; c <= sqrt(n); c++) {
        for (int d = c; d <= sqrt(n); d++) {
          if (a * a + b * b + c * c + d * d == n)
            cout << a << " " << b << " " << c << " " << d << endl;
        }
      }
    }
  }

  return 0;
}